#!/bin/sh

# pmap_larger PID threshold
# display the process PID with memory zone larger than 

if [  $# -ne 2 ]; then
  echo "Usage: $0 <PID> <threshold>"
  echo "  show the vm area whose RSS larger than <threshold>K of process <PID>"
  exit 1
fi

if [ -z "$1"  ]; then
  echo "Usage: $0 <PID> <threshold>"
  echo "  show the vm area whose RSS larger than <threshold>K of process <PID>"
  exit 1
fi

RSS_THRESHOLD=$2


pmap -x $1 | awk -v threshold="$RSS_THRESHOLD" 'NR==1 || $3 > threshold'
